﻿package net.wangit.dev.wizard.unit;

import net.wangit.context.ActionContext;
import net.wangit.dev.wizard.WizardUtil;
import net.wangit.framework.config.WizardSettings;
import net.wangit.jdbc.ColumnRow;
import net.wangit.jdbc.DB;
import net.wangit.jdbc.Table;

public class AFatherFormUnit {

	public AFatherFormUnit() {
	}

	public static final void create(ActionContext ac, DB db, String domain,
			String groupId, String unitId, String unitName, String tableName)
			throws Exception {
		Table table = new Table("dev", "UNIT");
		ColumnRow cRow = table.addInsertRow();
		cRow.set("uid", unitId);
		cRow.set("gid", groupId);
		cRow.set("c", 1);
		cRow.set("ti", unitName);
		cRow.set("st", 1);
		cRow.set("co", 4);
		cRow.set("cc", WizardSettings.instance().getFormColsConfig());
		cRow.set("t", tableName);
		cRow.set("dm", 1);
		cRow
				.set("de", WizardUtil.getFormUnitSql(db, domain, tableName,
						unitId));
		cRow.set("ub", 0);
		cRow.set("tb", 1);
		cRow.set("gb", 1);
		cRow.set("cb", 0);
		cRow.set("pp", 0);
		cRow.set("au", 0);
		cRow.set("ms", "1");
		cRow.set("me", "1");
		cRow.set("ma", "1");
		cRow.set("l", "0");
		cRow.set("y", "0");
		db.save(table);
	}
}
